package com.ziyun.erp.modules.production.dao;

import com.baomidou.mybatisplus.plugins.Page;
import com.ziyun.erp.modules.order.dto.OrderCraftQuoteDto;
import com.ziyun.erp.modules.order.vo.OrderCraftServerVo;
import com.ziyun.erp.modules.production.entity.ErpOrderProductionEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.ziyun.erp.modules.production.vo.ErpOrderProductionListVo;

import javafx.scene.control.Pagination;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * erp订单生产表
 *
 * @author guizhao
 * @email ...
 * @date 2018-08-22 10:32:12
 */
public interface ErpOrderProductionDao extends BaseMapper<ErpOrderProductionEntity> {

    /**
     * 数据更新
     *
     * @param map
     * @param productionId
     * @return
     */
    int updateByMap(@Param("map") Map<String, Object> map, @Param("productionId") Integer productionId);

    /**
     * 数据总数
     *
     * @param map
     * @return
     */
    int countProduction(@Param("map") Map<String, Object> map);

    /**
     * 列表查询(分页)
     *
     * @param map
     * @return
     */
    List<ErpOrderProductionListVo> queryPageProductionList(@Param("map") Map<String, Object> map);

    /**
     * 财务-生产成本-列表
     *
     * @param map
     * @return
     */
    List<ErpOrderProductionListVo> selectProductionList(Page<ErpOrderProductionListVo> page, @Param("map") Map<String, Object> map);

    /**
     * 列表查询
     *
     * @param map
     * @return
     */
    List<ErpOrderProductionListVo> queryProductionList(@Param("map") Map<String, Object> map);

    /**
     * 批量更新
     *
     * @param map
     * @param proIds
     * @return
     */
    int updateBatchByMap(@Param("map") Map<String, Object> map, @Param("proIds") List<Integer> proIds);

    /**
     * 查询已分配工序列表
     *
     * @param itemId
     * @return
     */
    List<OrderCraftQuoteDto> selectAllotedCraftsList(@Param("itemId") Integer itemId);

    /**
     * 查询已分配服务工序列表
     *
     * @param erpItemId
     * @return
     */
    List<OrderCraftServerVo> selectAllotedServerCraftsList(@Param("erpItemId") Integer erpItemId);

    List<ErpOrderProductionEntity> queryOtherOrderProduction(@Param("orderNo") String orderNo, @Param("productionId") Integer productionId);

    /*
     * 录入成本价
     */
    //void costUpdataByMap(@Param("cost")  BigDecimal cost, @Param("productionId") Integer productionId);

    /*
     * 生产成本
     * 订单付款
     */
    void payFromByMap(@Param("map") Map<String, Object> map, @Param("productionId") Integer productionId);

    List<ErpOrderProductionListVo> exportExcel(@Param("map") Map<String, Object> map);

    //查询客服备注
    String getAllRemark(String orderNo);

    int updateByMapOrderId(@Param("map") Map<String, Object> map, @Param("orderId") String orderId);

    Double sumProductionCost(@Param("map") Map<String, Object> map);

    List<ErpOrderProductionEntity> getErpOrderProductionEntity(String orderNo);

    int paymentProductionReview(@Param("productionId") Integer productionId);

    List<String> selectProducerOptions(@Param("map") Map<String, Object> map);
}

